<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<script src="<%=request.getContextPath() %>/resources/js/purchase/purchaseManage.js"
        type="text/javascript"></script>
<script src="<%=request.getContextPath() %>/resources/js/purchase/applicationS.js"
        type="text/javascript"></script>
<script src="<%=request.getContextPath() %>/resources/js/purchase/applicationView.js"
        type="text/javascript"></script>
<script>
    $(function () {
//        $('#totalAmount').numberbox({
//            precision:2,groupSeparator:',',decimalSeparator:'.'
//        })
//        $('#totalWeight').numberbox({
//            groupSeparator:',',decimalSeparator:'.'
//        })
//        $('#taxGoodsAmount').numberbox({
//            precision:2,groupSeparator:',',decimalSeparator:'.'
//        })
//        $('#taxAmount').numberbox({
//            precision:2,groupSeparator:',',decimalSeparator:'.'
//        })

        var applicationId = $("#applicationId").text();
        if (applicationId) {
            $('#memberNoDiv').html("<label>供应商代码:</label><input id='memberNo' name='f_providerid' data-options='required:true' readonly style='width:90px' />");
            $('#userNameDiv').html("<label>签约人:</label><input id='userName' name='userName' style='width:90px' readonly data-options='editable:false'/>");
            $('#userIdDiv').html("<label>签约人id:</label><input id='userName' name='f_userid' style='width:90px' data-options='editable:false'/>");
            //获取子项列表
            $.ajax({
                type: "post",
                data: {'id': applicationId},
                dataType: "json",
                url: getContextPath() + "/purchase/selectApplicationSub.html",
                before: function () {
                    parent.$.messager.progress({
                        title: '提示',
                        text: '数据处理中，请稍后....'
                    });
                },
                success: function (data) {
                    parent.$.messager.progress('close');
                    if (data && isSuccess(data.result)) {
                        //审核通过
                        $("#verifyApplication").click(function () {
                            changeStatus("/purchase/saveCommitApplicationSub.html", applicationId, 4, refreshApplicationOnlyViewPage);
                        });
                        //审核不通过
                        $("#notVerifyApplication").click(function () {
                            changeStatus("/purchase/saveCommitApplicationSub.html", applicationId, 3, refreshApplicationOnlyViewPage);
                        });
                        refreshApplicationOnlyViewPage(data);
                    } else {
                        commonError(data.result, data.message);
                    }
                },
                timeout: 1000,
                error: function (result) {
//			internalError();
                    templateInternalError(result.responseText);
                    parent.$.messager.progress('close');
                }
            });
        } else {
        }
    });

</script>
<var hidden="hidden" id="applicationId">${applicationId}</var>

<div class="easyui-layout" data-options="fit : true,border : false">
    <div data-options="region:'north',title:'采购申请审批',border : false" style="height: 140px; overflow: hidden;">
        <form id="searchForm-small">
            <div class="mLeft60">
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>采购申请号:</label>
                        <input id="applicationNumber" name="applicationNumber" readonly>
                        </input>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>申请状态:</label>
                        <input id="status" name="status" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome" id="memberNoDiv" readonly>
                        <label class="redSharp">* 供应商代码:</label>
                        <select id="memberNo" name="f_providerid" data-options="required:true" style="width:90px">
                        </select>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>供应商名称:</label>
                        <input id="providerName" name="providerName" class="easyui-input" readonly/>
                    </div>
                </div>
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome">
                        <label>供应商合同号:</label>
                        <input id="providerContract" name="providerContract" readonly>
                        </input>
                    </div>
                    <div class="fLeft label-handsome" id="userNameDiv" readonly>
                        <label class="redSharp">* 签约人:</label>
                        <select id="userName" name="f_userid" style="width:90px"
                                data-options="editable:false">
                        </select>
                    </div>
                    <div class="fLeft label-handsome">
                        <label>所属部门:</label>
                        <input id="signDept" name="signDept" class="easyui-input" readonly
                               data-options="editable:false"/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>制单人:</label>
                        <input id="documentMaker" name="documentMaker" class="easyui-input" readonly/>
                    </div>
                </div>
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>签约日期:</label>
                        <input id="contractDate" type="text" name="contractDate" class="easyui-datebox" readonly
                               required="required" style="width:90px"/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>备注:</label>
                        <input id="remark" name="remark" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>总金额:</label>
                        <input id="totalAmount" name="totalAmount" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>总重量:</label>
                        <input id="totalWeight" name="totalWeight" class="easyui-input" readonly/>
                    </div>
                </div>
                <div class="mTop10 line-handsome">
                    <div class="fLeft label-handsome ">
                        <label>含税货款金额:</label>
                        <input id="taxGoodsAmount" name="taxGoodsAmount" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>税额:</label>
                        <input id="taxAmount" name="taxAmount" class="easyui-input" readonly/>
                    </div>
                    <div class="fLeft label-handsome ">
                        <label>采购合同号:</label>
                        <input id="contractCode" name="contractCode" class="easyui-input" readonly/>
                    </div>
                    <div hidden="hidden" id="userIdDiv">
                    </div>

                </div>
            </div>
        </form>
    </div>
    <div data-options="region:'center',border : false,title:'采购申请子项列表'">
        <table id="subItem"></table>
    </div>
</div>